<?php 
namespace app\lib\exception;

use think\Exception;

class BaseException extends Exception{
	// HTTP 状态码404,200
	public $code = 400;
	// 错误具体信息
	public $msg = '参数错误';
	// 自定义错误码
	public $errorCode = 10000;

	public function __construct($params = []){
		if(!is_array($params)){
			return;
		}

		$paramKeys = ['code','msg','errorCode'];
		foreach ($paramKeys as $k => $v) {
			if(array_key_exists($v,$params)){
				$this->{$v} = $params[$v];
			}
		}
	}

}
?>